﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="原料入库单管理.aspx.cs" Inherits="syc.Store.原料入库单管理" %>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">原料入库单管理</div>
    <asp:Label ID="SelectedID" runat="server" Text="0" Visible="false"></asp:Label>
    <asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>
    
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <asp:Button ID="Button_New" runat="server" CssClass="button" 
            Text="录 入" UseSubmitBehavior="false" />
        <asp:Button ID="Button_View" runat="server" CssClass="button" 
            Text="查 看" UseSubmitBehavior="false" Enabled="false"/>
            
        <asp:Button ID="Button_Related" runat="server" CssClass="button" 
            Text="到货记录" UseSubmitBehavior="false" Enabled="false"/>
            
        <asp:Button ID="Button_Delete" runat="server" CssClass="button" 
            Text="删 除" UseSubmitBehavior="false" Enabled="false" 
            onclick="Button_Delete_Click" />
    </asp:Panel>

    <asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="查询栏">
    

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" >
        </asp:SqlDataSource>
        
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
        SelectCommand="SELECT [ID], 名称 FROM 原料供货单位 union select 0 as [ID] , '全部' as 名称">
        </asp:SqlDataSource>
        
        <span style="display:inline-block;width:220px;">原料类别：<asp:DropDownList ID="YuanLiao" runat="server" 
        DataSourceID="SqlDataSource2" DataTextField="品名" DataValueField="ID" Width="115px">
        </asp:DropDownList></span>
        
        <span style="display:inline-block;width:220px;">供货单位：<asp:DropDownList ID="GongHuo" runat="server" 
        DataSourceID="SqlDataSource3" DataTextField="名称" DataValueField="ID" Width="115px">
        </asp:DropDownList></span>

        <span style="display:inline-block;width:220px;">单 据 号：<asp:TextBox ID="DanHao" CssClass="textbox"
            runat="server" Width="80px"></asp:TextBox></span>
        
        <br />
        <span style="display:inline-block;width:220px;">开始日期：<asp:TextBox ID="Date1" 
            runat="server" CssClass="textbox" Width="115px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" /></span>
        <span style="display:inline-block;width:220px;">截止日期：<asp:TextBox ID="Date2" runat="server" CssClass="textbox" Width="115px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" /></span>
        <asp:Button ID="Button_Query" runat="server" CssClass="mbutton" Text="查 询" 
        UseSubmitBehavior="false" onclick="Button_Query_Click" />
        <asp:Button ID="Button_Reset" runat="server" Text="清空条件" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Reset_Click"/>
    </asp:Panel>
    
    <asp:Panel ID="Panel_Msg" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>

    <asp:Panel ID="Panel3" runat="server">

    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
	            <tr>
		            <td class="grid-title">原料入库单</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            onselected="SqlDataSource1_Selected" ></asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource1" 
                            GridLines="None" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                            UseAccessibleHeader="False" 
                            onselectedindexchanged="GridView1_SelectedIndexChanged">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                            
                                <asp:TemplateField HeaderText="">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                        <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="ID" SortExpression="ID" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="40px" />
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="单据号" SortExpression="单据号">
                                    <ItemTemplate>
                                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("单据号","{0:D7}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                                </asp:TemplateField>  
                                
                                <asp:TemplateField HeaderText="原料" SortExpression="原料">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("原料") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="规格" SortExpression="规格">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("规格") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="供货单位" SortExpression="供货单位">
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("供货单位") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="支数" SortExpression="数量">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("数量") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="重量(吨)" SortExpression="重量">
                                    <ItemTemplate>
                                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("重量") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="日期" SortExpression="日期">
                                    <ItemTemplate>
                                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("日期","{0:D}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                                </asp:TemplateField>  

                                <asp:TemplateField HeaderText="库管员" SortExpression="库管员">
                                    <ItemTemplate>
                                        <asp:Label ID="Label8" runat="server" Text='<%# Eval("库管员") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle CssClass="grid-header" />
                                    <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                                </asp:TemplateField>
                              

                            </Columns>
                            <SelectedRowStyle CssClass="grid-row-selected" />
                          </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    </asp:Panel>
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = function() { this.firstChild.firstChild.click(); };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }

    var Button_View = document.getElementById("Button_View");
    if (Button_View) {
        Button_View.onclick = function() {
        parent.swin_load("/Store/原料入库单.aspx?id=<%=this.SelectedID.Text %>");
        };
    }

    var Button_Related = document.getElementById("Button_Related");
    if (Button_Related) {
        Button_Related.onclick = function() {
            parent.swin_load("/Store/原料附件.aspx?id=<%=this.SelectedID.Text %>");
        };
    }

    var Button_Delete = document.getElementById("Button_Delete");
    if (Button_Delete) {
        Button_Delete.onclick = function() {
            if (confirm("确认要删除该条记录吗？")) {
                __doPostBack('Button_Delete', '')
            };
        }
    }

    document.getElementById("Button_New").onclick = function() {
    parent.swin_load("/Store/选择合格原料.aspx");
};

document.onkeydown = function(e) {
    if (!e) e = window.event;
    var tag = e.srcElement;
    if (!tag) tag = e.target;
    if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
        if (e.keyCode == 13) e.keyCode = 9;
    }
}
</script>
</body>
</html>
